package com.qf.fmcommodity.user.controller;

import com.qf.fmcommodity.user.entity.Orders;
import com.qf.fmcommodity.user.service.IOrdersService;
import com.qf.fmcommodity.user.vo.AddOrderReturnVo;
import com.qf.fmcommodity.user.vo.LoginVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Objects;

/**
 * <p>
 * 订单  前端控制器
 * </p>
 *
 * @author 苇名一心
 * @since 2023-02-13
 */
@RestController
@RequestMapping("/order")
@CrossOrigin
public class OrdersController {


    @Autowired
    IOrdersService iOrdersService;

    @PostMapping("/add")
    public LoginVo add(String[] cids,@RequestBody Orders orders) throws Exception {

        AddOrderReturnVo data = iOrdersService.addCopy(cids,orders);

        return LoginVo.ok(data);
    }

    @RequestMapping("/status/{oid}")
    public LoginVo status(@PathVariable("oid") String oId) throws Exception {

        String data = iOrdersService.status(oId);

        return LoginVo.ok(data);

    }

}
